﻿#region 命名空间

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
using Sharp.DataTransferObject;
using Sharp.Portal;
using Sharp.Portal.ExtNet;
using Sharp.Portal.Mvc;
using Sharp.Portal.Mvc.Form;
using Sharp.Portal.Mvc.Models;

#endregion

namespace Sharp.WebBooter.Areas.Demo.Models
{
    /// <summary>
    /// 用户
    /// </summary>
    [ItemPage(Width = 1000, OpenWith = OpenWith.Window2Column)]
    public class UserViewModel : BaseViewModel, ISharpForm
    {
        public UserViewModel()
        {
            UI = new ExtSharpFrom(this);
        }

        [HiddenInput]
        public int Id { get; set; }
        /// <summary>
        /// 获取或设置当前客户的用户名。
        /// </summary>
        [Display(Name = "用户名", Order = 0), Required]
        public string UserName { get; set; }

        [Display(Name = "电子邮件", Order = 1)]
        public string EMail { get; set; }

        /// <summary>
        /// 获取或设置当前客户的登录密码。
        /// </summary>
        [Display(Name = "密码", Order = 3, Prompt = "如果输入密码则密码重置"), DataType(DataType.Password)]
        public string Password { get; set; }

        /// <summary>
        /// 获取或设置当前客户的登录确认密码。
        /// </summary>
        [Display(Name = "确认密码", Order = 4, Prompt = "如果输入密码则密码重置")]
        [System.ComponentModel.DataAnnotations.Compare("Password"), DataType(DataType.Password)]
        public string ConfirmPassword { get; set; }

        /// <summary>
        /// 是否锁定
        /// </summary>
        [Display(Name = "是否锁定", Order = 6)]
        public bool IsLockedOut { get; set; }
        /// <summary>
        /// 是否激活
        /// </summary>
        [Display(Name = "是否激活", Order = 6)]
        public bool IsApproved { get; set; }

        /// <summary>
        /// 密码问题
        /// </summary>
        [StringLength(255)]
        public string PasswordQuestion { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        /// <value>备注</value>
        [StringLength(255), Display(Name = "备注"), DataType(DataType.MultilineText)]
        public string Comment { get; set; }



        /// <summary>
        /// 角色Id
        /// </summary>
        [Display(Name = "角色", Order = 5), CustomField(FieldType.DropDownList, "Name", "Id", nameof(RoleList))]
        public IEnumerable<int> RoleIds { get; set; }
        /// <summary>
        /// 上面的数据源
        /// </summary>
        public IEnumerable<RoleDTO> RoleList { get; set; }


        public SharpFrom UI { get; set; }


        [Section("有数据", ItemsFromAction = "Index,Data")]
        public string Test { get; set; }

        [Section("没数据", ItemsFromAction = "Index2,Data")]
        public string Test2 { get; set; }

    }

}